package com.chen.demo.simple.handler;

import com.chen.demo.simple.command.BookAddCommand;
import com.chen.demo.simple.domain.service.BookService;
import com.chen.winnerframework.cqrs.executor.CommandExecutor;
import com.chen.winnerframework.http.response.Response;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class BookAddCmdExe implements CommandExecutor<BookAddCommand, Response> {

    private final BookService bookService;

    @Override
    public Response execute(BookAddCommand command) {
        return bookService.saveBook(command);
    }
}
